home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / MacPerl 5.0.3 / MacPerl Source ƒ / Perl5 / lib / AutoLoader.pm < prev    next >
Encoding:
Perl POD Document  |  1995-03-19  |  707 b   |  28 lines  |  [TEXT/MPS ]

  1. package AutoLoader;
  2. use Carp;
  3.  
  4. AUTOLOAD {
  5. #    my $name = "auto/$AUTOLOAD.al";
  6. #    $name =~ s#::#/#g;
  7.     my $name = ":auto:$AUTOLOAD.al";
  8.     $name =~ s#::#:#g;
  9.     eval {require $name};
  10.     if ($@) {
  11.     # The load might just have failed because the filename was too
  12.     # long for some old SVR3 systems which treat long names as errors.
  13.     # If we can succesfully truncate a long name then it's worth a go.
  14.     # There is a slight risk that we could pick up the wrong file here
  15.     # but autosplit should have warned about that when splitting.
  16.     if ($name =~ s/(\w{12,})\.al$/substr($1,0,11).".al"/e){
  17.         eval {require $name};
  18.     }
  19.     if ($@){
  20.         $@ =~ s/ at .*\n//;
  21.         croak $@;
  22.     }
  23.     }
  24.     goto &$AUTOLOAD;
  25. }
  26.  
  27. 1;
  28.